Gpu-based tft-lcd mura defect detection method

ABSTRACT

The present disclosure discloses a GPU-based TFT-LCD Mura defect detection method, comprising: (1) establishing a studentized residual based double-second-order regression diagnosis model based original image data to obtain double-second-order regression background data; (2) obtaining influence quantities of respective data points on fitted values according to the original image data and the double-second-order regression background image data; (3) excluding outliers and influential points in the original image data according to the influence quantities to obtain a new pixel point set; (4) establishing a double-N-order polynomial surface fitting model according to the new pixel point set to obtain double-N-order background image data; (5) obtaining a residual image R according to the double-N-order background image data and the original image data, and performing threshold segmentation on the residual image to obtain a threshold segmentation image; and (6) performing morphological processing on the threshold segmentation image to obtain an eroded and dilated image, thereby achieving effective segmentation of Mura defects with uneven brightness distribution.

BACKGROUND Technical Field

The disclosure belongs to the field of display defect detection technology of liquid crystal displays, and more particularly relates to a GPU-based TFT-LCD Mura defect detection method.

Description of the Related Art

TFT-LCD (Thin Film Transistor Liquid Crystal Display) has become the most mainstream display device due to its characteristics of low power consumption, large size, high definition and the like, and is widely used in display fields such as LCD TVs and mobile terminals. Especially in a high-end display field such as HD and 3D, TFT-LCD has an absolute advantage.

The wide application of TFT-LCD and the consumers' increasing demand for high-performance display devices make the manufacturing technology and process of TFT-LCD more and more complicated, and in the process of manufacturing large quantities of TFT-LCD, certain bad products are inevitably generated. According to the defect morphology and background contrast, display defects of TFT-LCD are mainly divided into: point defect, line defect and Mura defect. The Mura defect features low contrast and uneven background brightness, and is easily interfered by background texture and complex noise, making the detection and repair of the Mura defects an important basis for enterprise competitiveness.

At present, the detection of Mura defects by major TFT-LCD panel manufacturers in the world mainly relies on naked-eye judgment of experienced testers, which features high cost, instability, low efficiency and the like. Machine vision defect detection is a non-contact detection method, and is widely used due to its characteristics of high degree of automation, good robustness and the like. However, in a defect image acquired by a CCD camera and the like, the Mura defect unevenness itself is blended with image background brightness unevenness due to uneven material of TFT-LCD, field of view deviation, uneven external light source and the like, resulting in that the automatic optical detection method cannot accurately detect the Mura defects, and is even worse than the manual detection method.

A main problem in the prior art is that the automatic optical detection method has poor self-adaptation, and high false detection rate and missing detection rate. For example, for different types of products and the same type of products with certain differences, the automatic optical detection method has poor self-adaptation and poor device debugging and operability. In addition, the current automatic optical detection method mainly adopts an inline detection mode, and in the prior art, a development environment such as a CPU is adopted, so that the detection time is long, and especially in a case of simultaneous detection of large-format and multiple images, the process efficiency is greatly affected.

Chinese Patent No. 201310405884.4, entitled “TFT-LCD Mura Defect Machine Vision Detection Method based on B-spline Surface Fitting”, discloses a method in which B-spline surface fitting is performed on original image data and then the background image is subtracted from the original image. This method has a poor detection effect on Mura defects with a large uneven brightness area or large noise, and large calculation amount, and thus cannot meet the requirements of practical applications.

SUMMARY

In view of the above-described defects in the art, the present disclosure aims to provide a GPU-based TFT-LCD Mura defect detection method, so as to solve the technical problem that the methods in the prior art have a poor detection effect on Mura defects with a large uneven brightness area or large noise, low detection precision and large calculation amount.

The present disclosure provides a GPU-based TFT-LCD Mura defect detection method, comprising:

(1) establishing a studentized residual based double-second-order regression diagnosis model based original image data, calculating first coefficients of the double-second-order regression diagnosis model, and fitting the first coefficients to obtain double-second-order regression background data;

(2) obtaining influence quantities WK of respective data points on fitted values according to the original image data and the double-second-order regression background image data,

wherein an influence quantity of an ith data point (z_(i), x_(i) ^(T)) on the fitted values is

${{WK}_{i} = {\frac{z_{i} - {(i)}}{{\hat{\sigma}(i)}\sqrt{p_{ii}}} = \sqrt{\frac{\left( {{\hat{\beta}(i)} - \hat{\beta}} \right)^{T}X^{T}{X\left( {{\hat{\beta}(i)} - \hat{\beta}} \right)}}{{\hat{\sigma}}^{2}(i)}}}};$

the larger the WK_(i), the greater the influence of the ith data point on the surface fitting, and conversely, the smaller the WK_(i), the smaller the influence of the ith data point on the surface fitting.

(3) excluding outliers and influential points in the original image data according to the influence quantities WK to obtain a new pixel point set Φ_(B);

(4) establishing a double-N-order polynomial surface fitting model according to the new pixel point set Φ_(B), calculating second coefficients of the double-N-order polynomial surface fitting model, and estimating double-N-order background image data according to the second coefficients;

(5) obtaining a residual image R=Z−Z+τ according to the double-N-order background image data and the original image data, and performing threshold segmentation on the residual image to obtain a threshold segmentation image;

(6) performing morphological processing on the threshold segmentation image to obtain an eroded and dilated image.

Further, the step (1) specifically comprises:

(1.1) establishing a studentized residual based double-second-order regression diagnosis model Z=Xβ+ε=p₀₀+p₁₀x+p₀₁y+p₂₀x²+p₁₁xy+p₀₂y²+ε;

(1.2) calculating estimation values {circumflex over (β)}=(X^(T)X)⁻¹X^(T)Z of the first coefficients of the double-second-order regression diagnosis model by using a least square method;

(1.3) fitting the estimation values of the first coefficients to obtain a double-second-order regression background image data

=X{circumflex over (β)}=X(X^(T)X)⁻¹X^(T),

wherein X represents a matrix representation of a horizontal and a vertical axis coordinates of a two-dimensional image; Z represents a pixel gray value at a corresponding coordinate position in X; p₀₀, p_(01,) . . . , p₂₀ represent the first coefficients of the double-second-order regression diagnosis model; ε represents a residual value, which satisfies ε˜(0, σ²I); β represents a vector representation of the first coefficients, and a confidence region of β at a level of 1−α is expressed as: ({circumflex over (β)}−β)X^(T)X({circumflex over (β)}−β)≤p{circumflex over (σ)}²F(p, n−p, 1−α), where p represents a number of coefficients of the double-second-order regression diagnosis model; n represents a total number of image pixel points; {circumflex over (β)} and {circumflex over (σ)} respectively represent least square estimations of the first coefficients {circumflex over (β)} and a variance α; and F(p, n−p) represents an F distribution.

Further, the TFT-LCD Mura defect detection method further comprises, before the step (1.1), the step of: performing Gabor filtering on the original image data to remove a moiré and a texture grid in an original image captured by a charge coupled device (CCD),

wherein the Gabor filtering operator includes:

${{g\left( {x,y,f,\theta} \right)} = {\frac{1}{ab}{{\exp\left\lbrack {- {\pi\left( {\frac{x_{r}^{2}}{a^{2}} + \frac{y_{r}^{2}}{b^{2}}} \right)}} \right\rbrack}\left\lbrack {{\exp \left( {i\; 2\pi \; {fx}_{r}} \right)} - {\exp\left( {- \frac{\pi^{2}}{2}} \right)}} \right\rbrack}}};$ x_(r) = x  cos   θ + y  sin   θ, y_(r) = −x  sin   θ + y  cos   θ,

ƒ represents a filtering frequency, and θ represents a filter direction; ƒ is ½T, where T represents a width of a texture unit.

Further, the filter directions θ are 0°, 45°, 90° and 135°, respectively. More filter directions can bring about enhanced filtering effect, but the calculation amount may be greatly increased, and thus, in general texture analysis, four filter directions are sufficient. In the image subjected to Gabor filtering in the present disclosure, the texture grid is basically suppressed.

Further, the step (3) specifically comprises:

(3.1) ranking the influence quantities WK from small to large, taking points whose WK rank top γ% as outlier regions, setting pixel values of the points to 1 and setting pixel values of other points to 0, thereby obtaining a binarized image Φ_(uv);

(3.2) performing median filtering on the binarized image Φ_(uv) to obtain a filtered outlier image Φf;

(3.3) ranking residual images E from large to small, taking points whose values rank top ω% as influential point regions, setting pixel values of the points to 1 and setting pixel values of other points to 0, thereby obtaining an influential point image Φg; and

(3.4) excluding the influential point image Φg and the outlier image Φf from an original image pixel point set Φ to obtain a new pixel point set Φ_(B),

wherein

$\Phi_{uv} = \left\{ {\begin{matrix} {1,} & {{WK}_{i} < {\gamma \mspace{14mu} \%}} \\ {0,} & {{WK}_{i} \geq {\gamma \mspace{14mu} \%}} \end{matrix},} \right.$

and γ represents an outlier threshold, which has a value range of 0 to 100; the residual image is E=|z−

|, z and

have the same meanings as above, and ω is 2 to 10; Φ_(B)=Φ−Φg−Φ.*Φf, where .* represents a dot product operation, and Φ_(B) represents a pixel point set obtained by excluding the influential points and the outliers from the original image pixel point set Φ; the outlier refers to a point that is far away from overall data points and unable to be well explained by an established regression model; the influential point refers to a point which greatly changes the regression model.

Further, since the brightness change trend of the overall image can be approximately estimated by the polynomial fitting, and the success or failure of the fitting depends largely on the selection of the polynomial order. If the polynomial order is too low, the fitting effect is poor, and an obvious block effect may occur. If the polynomial order is too high, on the one hand, the time consumed increases geometrically, and on the other hand, an over-fitting phenomenon may easily occur. Considering various factors comprehensively, it is preferable that N is 4 or 5; if N is 4, the step (4) specifically comprises:

(4.1) establishing a double-fourth-order polynomial surface fitting model Z=Xβ+ε=p₀₀+p₁₀x+p₀₁y+P₂₀x²+p₁₁xy+p₀₂y²+p₃₀x³+p₂₁x²y+p₁₂xy²+p₀₃y³+p₄₀x⁴+p₃₁x³y+p₂₂x²y²+p₁₃xy³+p₀₄y⁴+ε;

(4.2) calculating estimation values {circumflex over (β)}=(X^(T)X)⁻¹X^(T)Z of second coefficients of the double-fourth-order polynomial surface fitting model by using the least-squares method; and

(4.3) fitting the estimation values of the second coefficients to obtain a double-four-order background image data Z=X{circumflex over (β)}={circumflex over (p)}₀₀+{circumflex over (p)}₁₀x+{circumflex over (p)}₀₁y+{circumflex over (p)}₂₀x²+{circumflex over (p)}₁₁xy+{circumflex over (p)}₀₂y²+{circumflex over (p)}₃₀x³+{circumflex over (p)}₂₁x²y+{circumflex over (p)}₁₂xy²+{circumflex over (p)}₀₃y³+{circumflex over (p)}₄₀x⁴+{circumflex over (p)}₃₁x³y+{circumflex over (p)}₂₂x²y²+{circumflex over (p)}₁₃xy³+{circumflex over (p)}₀₄y⁴,

wherein X and Z respectively represents a coordinate data set and a gray data set corresponding to the new pixel point set Φ_(B) in which the outliers are excluded, p₀₀, p_(01,) . . . , p₄₀ represent the coefficients of the double-fourth-order polynomial surface fitting model, and Z represents a background image finally fitted from the original image.

Further, in the step (5), the threshold segmentation specifically comprises:

performing pixel dot product of the residual image R and an inversed binarized image to obtain a residual RES=(1−Φf).*R, in which the outlier regions are excluded; and

obtaining a threshold segmentation image T(u, v) according to the residual RES as well as an average value u_(Φ) and a variance σ_(Φ) of a background region,

wherein the threshold segmentation image is

${T\left( {u,v} \right)} = \left\{ {\begin{matrix} {1,} & {{{{{{RES}\left( {u,v} \right)} - u_{\Phi}}}/\sigma_{\Phi}} > {Thresh}} \\ {0,} & {{{{{{RES}\left( {u,v} \right)} - u_{\Phi}}}/\sigma_{\Phi}} \leq {Thresh}} \end{matrix},} \right.$

the average value of the background region is

${u_{\Phi} = \frac{\sum{RES}}{\sum\left( {1 - {\Phi \; f}} \right)}},$

the variance of the background region is

${\sigma_{\Phi} = \frac{\sum\left( {{RES} - u_{\Phi}} \right)^{2}}{\sum\left( {1 - {\Phi \; f}} \right)}},$

and the threshold value Thresh has a value range of 0.6 to 3.

Further, in the step (6), the morphological processing specifically comprises: performing an erosion operation to remove small connected regions in the threshold segmentation image, and then performing a dilation operation on the image subjected to the erosion operation to connect adjacent target regions, so as to obtain an eroded and dilated image.

Further, the steps (1)-(6) are all implemented based on parallel processing of a graphics processing unit, the parallel processing comprising: allocating GPU memory and threads, binding CUDA arrays stored in the GPU memory to CUDA texture memory, allocating shared memories, starting kernel and performing GPU coarse-grained and fine-grained collaborative parallel computing to implement the steps (1)-(6), and passing calculating results back to the CPU from the GPU.

Coarse-grained and fine-grained algorithm acceleration is achieved by GPU parallel processing in the steps (1)-(6), in which the so-called “fine-grained” refers to that data parallelism is developed with minimum grain at each stage of the algorithm; the so-called “coarse-grained” refers to that data sharing is performed in units of thread blocks at each stage of the algorithm. In the GPU, a two-dimensional thread grid is constituted by two-dimensional thread blocks, and each two-dimensional thread block is constituted by a plurality of threads, in which the ith pixel in the iterative data is calculated by the ith thread in the thread grid, and parallel processing is performed between respective blocks which cannot communicate with each other, ensuring the independence and stability between the data blocks. Meanwhile, threads in the same thread block exchange data through a shared memory, and through barrier synchronization, correct data sharing between the threads is ensured

In general, by comparing the above technical solution of the present inventive concept with the prior art, the present disclosure has the following beneficial effects:

(1) In the present disclosure, the regression diagnosis idea and the surface fitting method are effectively combined, in which the outlier regions and the influential point regions are excluded in the surface fitting to avoid the interference of the outliers and the influential points which allow the regression curve to move toward the outliers, thereby improving the accuracy of the background fitting. Therefore, the method of the present disclosure has a good detection effect on Mura defects with a large uneven brightness area or large noise.

(2) In the present disclosure, low-order regression diagnosis and high-order polynomial fitting are combined to perform background estimation, in which the low-order regression diagnosis belongs to rough fitting, which is convenient for searching outliers in the original image, and the high-order polynomial fitting belongs to fine fitting, which is a correction and supplement to the low-order fitting. Through effectively combining the rough fitting with the fine fitting, the defect of poor fitting precision caused by separate use of the two fittings can be avoided.

(3) in the present disclosure, a graphics processing unit (GPU) is effectively utilized to perform parallel acceleration, which can greatly reduce the processing time of the method. In addition, shared memories and texture memories are used to further reduce the GPU memory access time to realize high-speed and low-delay communication between threads, thereby greatly improving the efficiency of the detection process

(4) The method of the present disclosure has strong versatility, and can be applied to the detection of Mura defects with various morphologies on currently available liquid crystal displays of various specifications.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a flow chart of a TFT-LCD Mura defect detection method based on regression diagnosis and polynomial surface fitting according to the present disclosure;

FIG. 2 is a schematic diagram showing the TFT-LCD Mura defect detection method based on regression diagnosis and polynomial surface fitting, in which FIG. 2(a) shows an image subjected to image preprocessing of Gabor filtering, FIG. 2(b) shows a background image fitted by double-second-order regression diagnosis, FIG. 2(c) shows an image obtained by performing diagnosis measurement value binarization and median filtering on the regression diagnosis image, FIG. 2(d) shows a background image obtained by double-fourth-order polynomial fitting, FIG. 2(e) shows a residual image obtained by subtracting the background image obtained by the double-fourth-order polynomial fitting from the original image, and FIG. 2(f) shows an image obtained by performing Niblack's algorithm threshold on the residual image.

FIG. 3 is a flow chart showing parallel processing of GPU.

DETAILED DESCRIPTION OF THE EMBODIMENTS

For clear understanding of the objectives, features and advantages of the present disclosure, detailed description of the present disclosure will be given below in conjunction with accompanying drawings and specific embodiments. It should be noted that the embodiments described herein are only meant to explain the present disclosure, and not to limit the scope of the present disclosure. Furthermore, the technical features related to the embodiments of the disclosure described below can be mutually combined if they are not found to be mutually exclusive.

The disclosure belongs to the field of display defect detection technology of liquid crystal displays, and more particularly relates to a method for detecting Mura defects on a TFT-LCD by using machine vision, and the method proposed in the present disclosure has high detection efficiency and high detection accuracy. Meanwhile, with enhanced versatility and improved performance, the graphics processing unit (GPU) shows great potential when used as a general-purpose parallel processing unit, which is more and more obvious in fields of machine vision, graphics processing and the like. A lot of parallel processing is involved in the regression diagnostic and surface fitting methods, which provides the possibility for parallel implementation on the GPU. Therefore, the present disclosure is directed to utilizing the powerful parallel computing power of the GPU to achieve optimization and acceleration of the regression diagnosis method and the surface fitting method.

The present disclosure a high-precision, high-speed and high-stability Mura defect automatic optical detection method. In this method, a studentized residual based low-order regression diagnosis model is firstly established to predict and analyze outliers and influential points in the TFT-LCD image according to the Welsch's distance; binarization and median filtering are performed on the outlier region and the normal region, and then the outlier regions subjected to median filtering from the original image are excluded; high-order surface fitting is performed on the image in which the outlier regions are excluded, thereby fitting a background image, which is then used as an effective background region of the original image; the estimated background image is subtracted from the original image to obtain a residual image with uniform background, thereby effectively solving the problem of uneven brightness distribution. On this basis, various Mura defects can be segmented from the residual image by the Niblack's threshold segmentation method.

For the existing B-spline, polynomial and other surface fitting methods, it is necessary to perform control point inversion and forward fitting on a large amount of data at each time, resulting in a slow fitting speed. Embodiments of the present disclosure provide a background fitting method based on GPU acceleration, which reasonably utilizes GPU coarse-grained and fine-grained parallel collaborative processing. In addition, high-speed and low-delay communication between threads can be achieved by shared memories of the GPU, and texture memories of the GPU have a good acceleration effect on random access of large data. Thus, the GPU memory access time can be further reduced by the shared memories and texture memories, thereby greatly improving the processing efficiency of the method.

The present disclosure provides a GPU-based TFT-LCD Mura defect detection method, comprising:

(1) Image preprocessing: filtering the original image to remove the influence of moiré and texture grid. The filtering method includes, but is not limited to, Gabor filtering, Fourier transform or the like.

(2) Establishing a double-second-order regression diagnosis model, calculating coefficients of the double-second-order regression diagnosis model, and fitting the coefficients of the double-second-order regression diagnosis model to obtain a regression surface which approximately reflects a basic change trend of the image background.

(3) Calculating and excluding outliers and influential points, which specifically comprising the following steps: {circle around (1)} calculating diagnostic measurement values, ranking all the diagnostic measurement values from large to small, taking out pixels whose values rank top γ%, setting pixel values of the pixels to 1 and setting pixel values of other pixels to 0; {circle around (2)} performing median filtering on the binarized image in the step {circle around (1)}, in which a filtered region where the pixel value is 1 is an outlier region; {circle around (3)} ranking absolute values of the residual images from large to small, and taking points whose values rank top ω% as influential point regions; {circle around (4)} excluding the outlier regions and the influential point regions from the double-second-order regression diagnosis model.

(4) Establishing a fourth-order polynomial model, calculating coefficients of the fourth-order polynomial model, and estimating a background model.

(5) Subtracting the fourth-order background model from the original image to obtain a residual image with uniform background brightness, and normalizing the residual image.

(6) Niblack's threshold segmentation. The threshold segmentation method includes, but is not limited to, the Niblack's threshold segmentation.

In the embodiments of the present disclosure, the steps (1)-(6) are all implemented based on parallel processing of a graphics processing unit (GPU). The GPU collaborative parallel computing mainly includes: allocating GPU memory and threads, binding CUDA arrays stored in the GPU memory to CUDA texture memory, allocating shared memories, starting kernel and performing GPU coarse-grained and fine-grained collaborative parallel computing, and passing calculating results back to the CPU from the GPU.

GPU is far superior in speed and bandwidth to the current mainstream CPU processor due to its high-speed floating-point parallel computing power, and can achieve tens of times higher computational efficiency than CPU in vector computing. A lot of parallel operations are involved in computer vision image processing, and very suitable for GPU parallel processing. Therefore, the present disclosure utilizes the graphics processing unit (GPU) to perform parallel algorithm acceleration, which can greatly reduce the processing time of the algorithm, and thus improving the efficiency of the detection process.

According to an embodiment of the present invention, the step (6) further includes mathematical morphology processing, which is mainly to remove noise or small interference blocks in the image subjected to threshold segmentation, so that defect parts are completely presented without causing over-detection.

The present disclosure provides a simple and efficient TFT-LCD Mura defect detection method, which has advantages of high detection precision and fast detection speed, and can overcome shortcomings such as instability and low efficiency in the manual defect detection, as well as shortcomings such as large fitting deviation and low speed in the traditional B-spline surface fitting, polynomial surface fitting and the like. Specific description is given below:

(1) The method of the present disclosure has strong versatility, and can be applied to the detection of Mura defects with various morphologies on currently available liquid crystal displays of various specifications.

(2) In the present disclosure, the regression diagnosis idea and the surface fitting method are effectively combined, in which the outlier regions and the influential point regions are excluded in the surface fitting to avoid the interference of the outliers and the influential points which allow the regression curve to move toward the outliers, thereby improving the accuracy of the background fitting. Therefore, the method of the present disclosure has a good detection effect on Mura defects with a large uneven brightness area or large noise.

(3) In the present disclosure, low-order regression diagnosis and high-order polynomial fitting are combined to perform background estimation, in which the low-order regression diagnosis belongs to rough fitting, which is convenient for searching outliers in the original image, and the high-order polynomial fitting belongs to fine fitting, which is a correction and supplement to the low-order fitting. Through effectively combining the rough fitting with the fine fitting, the defect of poor fitting precision caused by separate use of the two fittings can be avoided.

(4) In the present disclosure, a graphics processing unit (GPU) is effectively utilized to perform parallel algorithm acceleration, which can greatly reduce the processing time of the algorithm. In addition, shared memories and texture memories are used to further reduce the GPU memory access time to realize high-speed and low-delay communication between threads, thereby greatly improving the efficiency of the detection process.

In order to further illustrate the GPU-based TFT-LCD Mura defect detection method according to the embodiments of the present disclosure, a detailed description is given below with reference to the drawings: FIG. 1 shows a flow chart of a GPU-based TFT-LCD Mura defect detection method according to embodiments of the present disclosure, the method comprising:

Step S101: allocating GPU memory space and performing initialization according to the size of a target image; copying the original image data from the CPU to the GPU memory, binding CUDA arrays in the GPU memory to texture memory, and reasonably allocating threads and shared memories, each pixel corresponding to one thread; and stating the kernel and performing GPU coarse-grained and fine-grained collaborative parallel computing, the GPU parallel computing being shown in FIG. 3.

Step S102: performing image preprocessing, i.e., performing Gabor filtering on the original image to remove moiré (the moiré refers to a high frequency fringe phenomenon appearing on an image captured by a device such as a digital camera whose photosensitive element is subjected to high frequency interference) and texture grid in the original image captured by CCD (the texture grid refers to a regularly arranged repeating texture background resulting from horizontal and vertical scan lines in the TFT substrate in camera image acquisition). The Gabor filtering is performed by using the GPU parallel convolution operation.

The Gabor filtering operator includes:

${g\left( {x,y,f,\theta} \right)} = {\frac{1}{ab}{{\exp\left\lbrack {- {\pi\left( {\frac{x_{r}^{2}}{a^{2}} + \frac{y_{r}^{2}}{b^{2}}} \right)}} \right\rbrack}\left\lbrack {{\exp \left( {i\; 2\pi \; {fx}_{r}} \right)} - {\exp\left( {- \frac{\pi^{2}}{2}} \right)}} \right\rbrack}}$

where x_(r)=x cos θ+y sin θ, y_(r)=x sin θ+y cos θ, ƒ represents a filtering frequency, and θ represents a filter direction. The filtering frequency ƒ has a value range of [ 1/16T, ½T], and in the present disclosure, ƒ is selected to be ½T, where T represents a width of a texture unit. In the present disclosure, taking into account operation time and performance, four filter directions θ of 0°, 45°, 90° and 135° are selected. More filter directions can bring about enhanced filtering effect, but it may greatly increase the calculation amount, and thus, in general texture analysis, four filter directions are sufficient. Filtered images with different directions are fused to obtain a final filtered image, as shown in FIG. 2(a). In the image subjected to the Gabor filtering, the texture grid is basically suppressed.

Step S103: establishing a studentized residual based double-second-order regression diagnosis model, calculating coefficients of the double-second-order regression diagnosis model, and fitting the coefficients of the double-second-order regression diagnosis model to obtain a regression surface which approximately reflects a basic change trend of the image background, as shown in FIG. 2(b). The regression analysis model is a statistical model for studying the relationship between multiple variables, and through the regression analysis model, possible outliers and influential points can be detected in the TFT-LCD. Background information of an image can be approximately estimated by polynomial fitting, but in practical applications, the accuracy of the polynomial fitting is susceptible to interference from outliers and influential points in the original image, so that the polynomial fitting is deviated from the normal fitting direction. Therefore, it is necessary to exclude outliers and influential points based on the double-second-order regression diagnosis model before performing polynomial fitting, so as to improve the accuracy of the polynomial fitting.

(1) Establishing of a studentized residual based double-second-order regression diagnosis model

The studentized residual based double-second-order regression diagnosis model may be expressed as:

Z=Xβ+ε=p ₀₀ +p ₁₀ x+p ₀₁ y+p ₂₀ x ² +p ₁₁ xy+p ₀₂ y ²+ε,

wherein X represents a matrix representation of horizontal and vertical axis coordinates of a two-dimensional image; Z represents a pixel gray value at a corresponding coordinate position in X; p₀₀, p_(01,) . . . , p₂₀ represents first coefficients of the double-second-order regression diagnosis model; ε represents a residual value, which satisfies ε˜(0, σ²I); β represents a vector representation of the first coefficients, and a confidence region of β at a level of 1−α is expressed as:

({circumflex over (β)}−β)X ^(T) X({circumflex over (β)}−β)≤p{circumflex over (σ)} ² F(p, n−p, 1−α),

where p represents the number of coefficients of the double-second-order regression diagnosis model; n represents the total number of image pixel points; {circumflex over (β)} and {circumflex over (σ)} respectively represent least square estimations of the coefficients β and the variance σ; and F(p, n−p) represents F distribution;

(2) Calculation of estimation values of coefficients of the double-second-order regression diagnosis model by using least square method (LSM). The estimation values of the coefficients in the least squares sense are: {circumflex over (β)}=(X^(T)X)⁻¹X^(T)Z;

(3) Double-second-order regression background image fitting. The double-second-order regression background image, obtained by fitting estimation values of the coefficients of the regression diagnosis model, is expressed as:

=X{circumflex over (β)}=X(X^(T)X)⁻¹X^(T).

Step S104: regression diagnosis of outliers and influential points. The outliers refer to points that are far away from overall data points and unable to be well explained by an established regression model. In TFT-LCD, outliers may be Mura defects with uneven brightness or uneven color in the image, and the existence of the outliers may cause the estimated regression surface to move toward the outliers, which results in a large residual in the established regression model. The influential points refer to points which greatly change the regression model, often resulting in a very different analysis result. Therefore, the outliers and the influential points should be diagnosed and excluded in practice.

A data deletion model of the ith data points (z_(i), x_(i) ^(T)) can be expressed as Z(i)=X(i)β+ε(i), where X(i) represents a data set obtained by removing x_(i) ^(T) in the ith line from a coordinate data set X, Z(i) represents a data set obtained by removing z_(i) in the ith line from a gray data set Z, z_(i) represents a gray value of the ith data point, and x_(i) ^(T) represents a coordinate vector of the ith data point. Least square estimation values {circumflex over (β)} and {circumflex over (σ)}² of β and δ² of the model Z=Xβ+ε and corresponding estimation values {circumflex over (β)}(i) and {circumflex over (σ)}²(i) in Z(i)=X(i)β+ε(i) has the following relationship:

${{\hat{\beta}(i)} = {\hat{\beta} - \frac{\left( {X^{T}X} \right)^{- 1}x_{i}{\hat{e}}_{i}}{1 - p_{ii}}}},{{{\hat{\sigma}}^{2}(i)} = {\frac{\left( {n - p - r_{i}^{2}} \right)}{n - p - 1}{\hat{\sigma}}^{2}}}$ e ^ i = z i - i , z ^ i = x i T  β ^ , r i = e ^ i σ ^  1 - p ii

where p_(ii) represents a diagonal element of a projection matrix P=X(X^(T)X)⁻¹X^(T) generated by X, ê_(i) represents a residual value of the ith data point, r_(i) represents a standardized residual, and other parameters are the same as above.

Then, the influence of the ith data point (z_(i), x_(i) ^(T)) on fitted values is defined as:

${{WK}_{i} = {\frac{z_{i} - {(i)}}{{\hat{\sigma}(i)}\sqrt{p_{ii}}} = \sqrt{\frac{\left( {{\hat{\beta}(i)} - \hat{\beta}} \right)^{T}X^{T}{X\left( {{\hat{\beta}(i)} - \hat{\beta}} \right)}}{{\hat{\sigma}}^{2}(i)}}}},$

where WK_(i) represents the Welsch-Kuh distance, which is referred to as the WK statistic. The larger the WK_(i), the greater the influence of the ith data point on the surface fitting. Conversely, the smaller the value of the WK_(i), the smaller the influence of the ith data point on the surface fitting.

Step S105: exclusion of the outliers and influential points

(1) Ranking WK from small to large, taking points whose values rank top γ% as outlier regions, setting pixel values of the points to 1 and setting pixel values of other points to 0, thereby obtaining a binarized image as below:

$\Phi_{uv} = \left\{ {\begin{matrix} {1,} & {{WK}_{i} < {\gamma \mspace{14mu} \%}} \\ {0,} & {{WK}_{i} \geq {\gamma \mspace{14mu} \%}} \end{matrix},} \right.$

where γ represents an outlier threshold, which has a value range of 0 to 100.

(2) Performing median filtering on the binarized image φ_(uv) to filter out scattered points which are regarded as non-influential outliers. The obtained outlier image is expressed as Φf. An image obtained by diagnostic measurement value binarization and median filtering is shown in FIG. 2(c).

(3) Ranking absolute values of the residual images E from large to small, taking points whose values rank top ω% as influential point regions, setting pixel values of the points to 1 and setting pixel values of other points to 0. The influential point image is expressed as Φg, and the residual images E is expressed as:

E=|z−

|,

where z and

have the same meaning as above, and the tests showed that when ω is preferably 2 to 10.

(4) Excluding the influential point image Φg and the outlier image Φf from an original image pixel point set Φ to obtain a new pixel point set Φ_(B).

Φ_(B)=Φ−Φg−Φ.*Φf, where .* represents a dot product operation, and Φ_(B) represents a pixel point set obtained by excluding the influential points and the outliers from the original image pixel point set Φ, and through fitting the pixel point set Φ_(B), the interference of the influential points and the outliers can be effectively eliminated, thereby improving the fitting precision.

Step S106: establishing a double-fourth-order polynomial surface fitting model, calculating coefficients of the double-fourth-order polynomial surface fitting model according to the new pixel point set, and estimating a background model according to the coefficients of the double-fourth-order polynomial surface fitting model, as shown in FIG. 2(d). The brightness change trend of the overall image can be approximately estimated by the polynomial fitting, and the success or failure of the fitting depends largely on the selection of the polynomial order. If the polynomial order is too low, the fitting effect is poor, and an obvious block effect may occur. If the polynomial order is too high, on the one hand, the time consumed increases geometrically, and on the other hand, an over-fitting phenomenon may easily occur. Considering various factors comprehensively, it is preferable that the highest order of the actual fitting polynomial is 4 or 5.

(1) Establishing a double-fourth-order polynomial surface fitting model Z=Xβ+ε=p₀₀+p₁₀x+p₀₁y+p₂₀x²+p₁₁xy+p₀₂y²+p₃₀x³+p₂₁x²y+p₁₂xy²+p₀₃y³+p₄₀x⁴+p₃₁x³y+p₂₂x²y²+p₁₃xy³+p₀₄y⁴+ε;

wherein X and Z respectively represents a coordinate data set and a gray data set corresponding to the new pixel point set Φ_(B) in which the outliers are excluded, and p₀₀, p_(01,) . . . , p₄₀ represent the coefficients of the double-fourth-order polynomial surface fitting model.

(2) Calculating estimation values of coefficients of the double-fourth-order polynomial surface fitting model by using the least-squares method. The estimation values of the coefficients in the least squares sense are expressed as: {circumflex over (β)}=(X^(T)X)⁻¹X^(T)Z. There are fifteen coefficients in the fourth-order polynomial model and six coefficients in the second-order regression model, and they respectively correspond to different weights of the regression diagnose and the polynomial functions.

(3) According to the estimated coefficients {circumflex over (p)}₀₀˜{circumflex over (p)}₀₄ of the double-fourth-order polynomial surface fitting model, a background image can be obtained:

Z=X{circumflex over (β)}={circumflex over (p)} ₀₀ +{circumflex over (p)} ₁₀ x+{circumflex over (p)} ₀₁ y+{circumflex over (p)} ₂₀ x ² +{circumflex over (p)} ₁₁ xy+{circumflex over (p)} ₀₂ y ² {circumflex over (p)} ₃₀ x ³ +{circumflex over (p)} ₂₁ x ² y+{circumflex over (p)} ₁₂ xy ² +{circumflex over (p)} ₀₃ y ³ +{circumflex over (p)} ₄₀ x ⁴ +{circumflex over (p)} ₃₁ x ³ y+{circumflex over (p)} ₂₂ x ² y ² +{circumflex over (p)} ₁₃ xy ³ +{circumflex over (p)} ₀₄ y ⁴,

The background image Z, which is finally fitted from the original image, reflects the basic brightness change trend of the overall image.

Step S107: image difference method. A residual image R is obtained by subtracting the background image fitted by the double-fourth-order polynomial surface fitting model from the original image Z. Since some pixel values after subtraction may be less than 0 (usually a position with a pixel value of greater than 0 indicates a bright Mura, and a position with a pixel value of less than 0 indicates a dark Mura), some information may be lost when direct rounding is performed on the pixel values. Therefore, a positive offset τ is added to the original residual image to normalize all pixels to a range greater than zero. By using the obtained residual image, the problem of uneven background brightness can be effectively solved, and the bright or dark Mura can be detected in one step without separately processing the bright or dark Mura. The difference image obtained in step S107 is shown in FIG. 2(e). R=Z−Z+τ.

Step S108: Niblack's threshold segmentation. An appropriate threshold value Thresh is selected, and repeated trials showed that the threshold value Thresh is preferably 0.6 to 3. A pixel gray value greater than the threshold value Thresh is set to 1, and a pixel gray value lower than the threshold value Thresh is set to 0.

The principle of the Niblack's threshold segmentation method is as follows: pixel dot product of the residual image R and the inversed binarized image is performed to obtain a residual RES=(1−Φf).*R, in which the outlier regions are excluded. The average value and the variance of the background region in the residual image are respectively calculated as follows:

$u_{\Phi} = {{\frac{\sum{RES}}{\sum\left( {1 - {\Phi \; f}} \right)}\mspace{14mu} {and}\mspace{14mu} \sigma_{\Phi}} = {\frac{\sum\left( {{RES} - u_{\Phi}} \right)^{2}}{\sum\left( {1 - {\Phi \; f}} \right)}.}}$

Therefore, a threshold segmentation image T obtained by using the Niblack's threshold segmentation method can be expressed as:

${T\left( {u,v} \right)} = \left\{ {\begin{matrix} 1 & {{{{{{RES}\left( {u,v} \right)} - u_{\Phi}}}/\sigma_{\Phi}} > {Thresh}} \\ 0 & {{{{{{RES}\left( {u,v} \right)} - u_{\Phi}}}/\sigma_{\Phi}} \leq {Thresh}} \end{matrix}.} \right.$

Step S109: morphological processing. Erosion and then dilation is called an opening operation. The opening operation can eliminate the splashes and burrs, that is, smoothing the image. Dilation and then erosion is called a closing operation, by which the two adjacent parts can be connected in a case of selecting the appropriate element structure. In the binary image obtained after threshold segmentation, there are some small dots or lines, which are canine-shaped and hole-shaped, around or inside the defect boundary. Therefore, morphological processing is performed on the threshold segmentation image in the step S108, and the morphological processing specifically includes: performing erosion operation on the threshold segmentation image to remove small connected regions and then performing dilation operation on the image subjected to erosion operation to connect adjacent target regions. The resulting eroded and dilated image is shown in FIG. 2(f), and it can be seen from FIG. 2(f) that Mura defects with uneven brightness distribution can be effectively segmented by the method in the present disclosure.

Step S10: copying the resulting image subjected to morphological processing from the GPU to the CPU memory, performing texture unbinding, and releasing the GPU and CPU memories in time.

The method in the present disclosure was compared with the CPU serial implementation method, in which three test images of 2048×2048, 3560×4288 and 3240×5760 were processed by the CPU and the GPU, respectively, and processing times were recorded in Table 1.

TABLE 1 processing times of GPU and CPU Size of target Running time (s) image CPU processing GPU processing 2048 × 2048 18 0.32 3560 × 4288 38 0.49 3240 × 5760 45 0.53

As can be seen from Table 1, the processing time required by the method of the present disclosure is greatly shortened compared to the conventional CPU method, and the GPU parallel implementation is 55-85 times faster than the CPU implementation. More importantly, the processing time required by the method of the present disclosure is less than 1 second at a resolution of 3560×4288, or even at an ultra-high resolution of 3240×5760, so that real-time processing can be achieved, regardless of whether the method of the present disclosure is used for on-line processing or off-line processing. This demonstrates the effectiveness of the GPU acceleration and the real-time processing performance in the method of the present disclosure.

It should be readily understood to those skilled in the art that the above description is only preferred embodiments of the present disclosure, and does not limit the scope of the present disclosure. Any change, equivalent substitution and modification made without departing from the spirit and scope of the present disclosure should be included within the scope of the protection of the present disclosure. 

1. A GPU-based TFT-LCD Mura defect detection method, comprising the steps of: (1) establishing a studentized residual based double-second-order regression diagnosis model based original image data, calculating first coefficients of the double-second-order regression diagnosis model, and fitting the first coefficients to obtain double-second-order regression background data; (2) obtaining influence quantities WK of respective data points on fitted values according to the original image data and the double-second-order regression background image data, wherein an influence quantity of an ith data point (z_(i), x_(i) ^(T)) on the fitted values is ${{WK}_{i} = {\frac{z_{i} - {(i)}}{{\hat{\sigma}(i)}\sqrt{p_{ii}}} = \sqrt{\frac{\left( {{\hat{\beta}(i)} - \hat{\beta}} \right)^{T}X^{T}{X\left( {{\hat{\beta}(i)} - \hat{\beta}} \right)}}{{\hat{\sigma}}^{2}(i)}}}};$ a data deletion model of the ith data points (z_(i), x_(i) ^(T)) is expressed as Z(i)=X(i)β+ε(i), where X(i) represents a data set obtained by removing x_(i) ^(T) in an ith line from a coordinate data set X, Z(i) represents a data set obtained by removing z_(i) in the ith line from a gray data set Z, z_(i) represents a gray value of the ith data point, and x_(i) ^(T) represents a coordinate vector of the ith data point; p_(ii) represents a diagonal element of a projection matrix P=X(X^(T)X)⁻¹X^(T) generated by X; (3) excluding outliers and influential points in the original image data according to the influence quantities WK to obtain a new pixel point set Φ_(B); (4) establishing a double-N-order polynomial surface fitting model according to the new pixel point set Φ_(B), calculating second coefficients of the double-N-order polynomial surface fitting model, and estimating double-N-order background image data Z according to the second coefficients; (5) obtaining a residual image R=Z−Z+τ according to the double-N-order background image data and the original image data, and performing threshold segmentation on the residual image to obtain a threshold segmentation image; (6) performing morphological processing on the threshold segmentation image to obtain an eroded and dilated image, wherein the step (1) specifically comprises: (1.1) establishing a studentized residual based double-second-order regression diagnosis model Z=Xβ+ε=p₀₀+p₁₀x+p₀₁y+p₂₀x²+p₁₁xy+p₀₂y²+ε; (1.2) calculating estimation values {circumflex over (β)}=(X^(T)X)⁻¹X^(T)Z of the first coefficients of the double-second-order regression diagnosis model by using a least square method; (1.3) fitting the estimation values of the first coefficients to obtain a double-second-order regression background image data

=X{circumflex over (β)}=X((X^(T)X)⁻¹X^(T), wherein X represents a matrix representation of a horizontal and a vertical axis coordinates of a two-dimensional image; Z represents a pixel gray value at a corresponding coordinate position in X; p₀₀, p_(01,) . . . , p₂₀ represent the first coefficients of the double-second-order regression diagnosis model; ε represents a residual value, which satisfies ε˜(0, σ²I), where I represents a unit matrix; β represents a vector representation of the first coefficients, and a confidence region of β at a level of 1−α is expressed as: ({circumflex over (β)}−β)X^(T)X({circumflex over (β)}−β)≤p{circumflex over (σ)}²F(p, n−p, 1−α), where p represents a number of coefficients of the double-second-order regression diagnosis model; n represents a total number of image pixel points; {circumflex over (β)} and {circumflex over (σ)} respectively represent least square estimations of the first coefficients β and a variance σ; and F(p, n−p) represents an F distribution.
 2. (canceled)
 3. The TFT-LCD Mura defect detection method according to claim 1, further comprising, before the step (1.1), the step of: performing Gabor filtering on the original image data to remove a moiré and a texture grid in an original image captured by a charge coupled device, wherein the Gabor filtering operator includes: ${{g\left( {x,y,f,\theta} \right)} = {\frac{1}{ab}{{\exp\left\lbrack {- {\pi\left( {\frac{x_{r}^{2}}{a^{2}} + \frac{y_{r}^{2}}{b^{2}}} \right)}} \right\rbrack}\left\lbrack {{\exp \left( {i\; 2\pi \; {fx}_{r}} \right)} - {\exp\left( {- \frac{\pi^{2}}{2}} \right)}} \right\rbrack}}};$ x_(r) = x  cos   θ + y  sin   θ, y_(r) = −x  sin   θ + y  cos   θ, represents a filtering frequency, and θ represents a filter direction; ƒ is ½T, where T represents a width of a texture unit.
 4. The TFT-LCD Mura defect detection method according to claim 3, wherein the filter directions θ are 0°, 45°, 90° and 135°, respectively.
 5. The TFT-LCD Mura defect detection method according to claim 1, wherein the step (3) specifically comprises: (3.1) ranking the influence quantities WK from small to large, taking points whose WK rank top γ% as outlier regions, setting pixel values of the points to 1 and setting pixel values of other points to 0, thereby obtaining a binarized image Φ_(uv); (3.2) performing median filtering on the binarized image Φ_(uv) to obtain a filtered outlier image Φf; (3.3) ranking residual images E from large to small, taking points whose values rank top ω% as influential point regions, setting pixel values of the points to 1 and setting pixel values of other points to 0, thereby obtaining an influential point image Φg; and (3.4) excluding the influential point image Φg and the outlier image Φf from an original image pixel point set Φ to obtain a new pixel point set Φ_(B), wherein $\Phi_{uv} = \left\{ {\begin{matrix} {1,} & {{WK}_{i} < {\gamma \mspace{14mu} \%}} \\ {0,} & {{WK}_{i} \geq {\gamma \mspace{14mu} \%}} \end{matrix},} \right.$ and γ represents an outlier threshold, which has a value range of 0 to 100; the residual image is E=|z−

, z and

have the same meanings as above, and ω is 2 to 10; Φ_(B)=Φ−Φg−Φ.*Φf, where .* represents a dot product operation, and Φ_(B) represents a pixel point set obtained by excluding the influential points and the outliers from the original image pixel point set Φ; the outlier refers to a point that is far away from overall data points and unable to be well explained by an established regression model; the influential point refers to a point which greatly changes the regression model.
 6. The TFT-LCD Mura defect detection method according to claim 1, wherein N is 4 or 5; if N is 4, the step (4) specifically comprises: (4.1) establishing a double-fourth-order polynomial surface fitting model Z=Xβ+ε=p₀₀+p₁₀+p₀₁y+p₂₀x²+p₁₁xy+p₀₂y²+p₃₀x³+p₂₁x²+p₁₂xy²+p₀₃y³+p₄₀x⁴+p₃₁x²y+p₂₂x²y²+p₁₃xy³+p₀₄y⁴+ε; (4.2) calculating estimation values {circumflex over (β)}=(X^(T)X)⁻¹X^(T)Z of second coefficients of the double-fourth-order polynomial surface fitting model by using the least-squares method; and (4.3) fitting the estimation values of the second coefficients to obtain a double-fourth-order background image data Z=X{circumflex over (β)}={circumflex over (p)}₀₀+{circumflex over (p)}₁₀x+{circumflex over (p)}₀₁y+{circumflex over (p)}₂₀x²+{circumflex over (p)}₁₁xy+{circumflex over (p)}₀₂y²+{circumflex over (p)}₃₀x³+{circumflex over (p)}₂₁x²y+{circumflex over (p)}₁₂xy²+{circumflex over (p)}₀₃y³+{circumflex over (p)}₄₀x⁴+{circumflex over (p)}₃₁x³y+{circumflex over (p)}₂₂x²y²+{circumflex over (p)}₁₃xy³+{circumflex over (p)}₀₄y⁴, wherein X and Z respectively represents a coordinate data set and a gray data set corresponding to the new pixel point set Φ_(B) in which the outliers and the influential points are excluded, p₀₀, p_(01,) . . . , p₄₀ represent the second coefficients of the double-fourth-order polynomial surface fitting model, and Z represents a background image finally fitted from the original image.
 7. The TFT-LCD Mura defect detection method according to claim 5, wherein in the step (5), the threshold segmentation specifically comprises: performing pixel dot product of the residual image R and an inversed binarized image to obtain a residual RES=(1−Φf).*R, in which the outlier regions are excluded; and obtaining a threshold segmentation image T(u, v) according to the residual RES as well as an average value u_(Φ) and a variance σ_(Φ) of a background region, u and v represent coordinates of horizontal and vertical directions of an image, respectively; the threshold segmentation image is the average value of the background region is ${T\left( {u,v} \right)} = \left\{ {\begin{matrix} {1,} & {{{{{{RES}\left( {u,v} \right)} - u_{\Phi}}}/\sigma_{\Phi}} > {Thresh}} \\ {0,} & {{{{{{RES}\left( {u,v} \right)} - u_{\Phi}}}/\sigma_{\Phi}} \leq {Thresh}} \end{matrix},} \right.$ the average value of the background region is ${u_{\Phi} = \frac{\sum{RES}}{\sum\left( {1 - {\Phi \; f}} \right)}},$ the variance of the background region is ${\sigma_{\Phi} = \frac{\sum\left( {{RES} - u_{\Phi}} \right)^{2}}{\sum\left( {1 - {\Phi \; f}} \right)}},$ and the threshold value Thresh has a value range of 0.6 to
 3. 8. The TFT-LCD Mura defect detection method according to claim 1, wherein in the step (6), the morphological processing specifically comprises: performing an erosion operation to remove small connected regions in the threshold segmentation image, and then performing a dilation operation on the image subjected to the erosion operation to connect adjacent target regions, so as to obtain an eroded and dilated image.
 9. The TFT-LCD Mura defect detection method according to claim 1, wherein the steps (1)-(6) are all implemented based on parallel processing of a graphics processing unit, the parallel processing comprising: allocating GPU memory and threads, binding CUDA arrays stored in the GPU memory to CUDA texture memory, allocating shared memories, starting kernel and performing GPU coarse-grained and fine-grained collaborative parallel computing to implement the steps (1)-(6), and passing calculating results back to the CPU from the GPU. 